#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"

class LocalScene;

class ResourceProcess : public RenderProcess
{
	DECLARE_PROCESS(ResourceProcess)


protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

public:

	LocalScene* mLocalScene;

	// 0 or 1
	uint32 mCurrMask;

	uint32 mPrevMask;


	std::vector<LocalEntity*> mOpaqueEntitys;

	std::vector<GBufferPushConstants> mGBufferPushConstants;

	float mRoughnessMultiplier;

	PerFrameUbo mPerFrameUbo;

	std::vector<glm::vec2> mJitterSamples;

	glm::vec2 mPrevJitter;

	glm::vec2 mCurrentJitter;


	std::vector<MaterialGpu> mMaterials;

	RefCountPtr<RHIBuffer> mMaterialBuffer;

	std::vector<ObjectDescGpu> mObjectDescs;

	RefCountPtr<RHIBuffer> mObjectDescBuffer;

	RefCountPtr<RHIBuffer> mPerFrameUboBuffer;

	RefCountPtr<AccelerationStructure> mTopLevelAS;

	RefCountPtr<RHISampler> mTrilinearSampler;

	RefCountPtr<RHISampler> mBiLinearSampler;

	RefCountPtr<RHISampler> mNearestSampler;

	RefCountPtr<RHITexture> mSobolSequence;

	RefCountPtr<RHITexture> mScramblingRankingSPP1;

	RefCountPtr<RHITexture> mScramblingRankingSPP2;

	RefCountPtr<RHITexture> mScramblingRankingSPP4;

	RefCountPtr<RHITexture> mScramblingRankingSPP8;

	RefCountPtr<RHITexture> mScramblingRankingSPP16;

	RefCountPtr<RHITexture> mScramblingRankingSPP32;

	RefCountPtr<RHITexture> mScramblingRankingSPP64;

	RefCountPtr<RHITexture> mScramblingRankingSPP128;

	RefCountPtr<RHITexture> mScramblingRankingSPP256;

};
